var fileSystemObject = new ActiveXObject("Scripting.FileSystemObject");
var adoStream;
//将临时文件上传至服务器
function uploadPhotoImg(imagePath){
	var basePath=$("#basePath").val();
	var firstGuid=$("#firstGuid").val();
	//var fileName = CAPTURE.photoJPSImg();
	//alert(basePath+"--"+firstGuid);
	adoStream = new ActiveXObject("ADODB.Stream");
	adoStream.Mode = 3;//read write
			
	adoStream.Open();
	adoStream.Type = 1;
		   	
	var fileType = imagePath.substring(imagePath.lastIndexOf(".")+1);
	var upOneURL = basePath+"/upload/uploadLocalImg";
	adohttp = getXMLHttpRequest();
	adohttp.open('post', upOneURL, false);
	adohttp.setRequestHeader('-fileType',fileType);
	adohttp.setRequestHeader('-firstGuid',firstGuid);//Scan.MrId
			
			
	adohttp.setRequestHeader('-pageOneLocalPath',imagePath.replace(/\\/g,"/"));
	adohttp.setRequestHeader('Content-Type', 'application/x- www-form-urlencoded');

		   	
	adoStream.LoadFromFile(imagePath);
			
			
	var fileSize = fileSystemObject.GetFile(imagePath).Size;
	var adoStreamSize = adoStream.Size;
			
	if (fileSize != adoStreamSize || fileSize < 3584 || adoStreamSize < 3584){
		adoStream.Close();////
		adoStream = null;
		adohttp = null;
		return "noUp";
	}
			
	adohttp.setRequestHeader("Content-Length",adoStream.Size);
			
	adohttp.send(adoStream.Read(adoStream.Size));
	//返回数据
	var result = JSON.parse(adohttp.responseText);
		   
		   	
	adoStream.Close();////
	adoStream = null;
		   	
	adohttp = null;
		   	
	return result;
}

//获取XmlHttpRequest
function getXMLHttpRequest(){
	var XMLHttpRequest = null;
	if (typeof ActiveXObject != "undefined") {
		var aVersions = ["Microsoft.XMLHTTP", "Msxml2.XMLHttp.6.0", "Msxml2.XMLHttp.5.0", "Msxml2.XMLHttp.4.0", "Msxml2.XMLHttp.3.0"];
		for (var i = 0; i < aVersions.length; i++) {
			try {XMLHttpRequest = new ActiveXObject(aVersions[i]);}catch (ex) {}//注释：不能alert循环的创建的
		}
	} else if (typeof XMLHttpRequest != "undefined"){
		XMLHttpRequest = new XMLHttpRequest();
	}
			
		return XMLHttpRequest;
}
		
		